package com.itheima.blog.admin.controller;

import com.itheima.api.client.vo.ProvinceBLogNum;
import com.itheima.api.client.vo.TBlogByCategoryID;
import com.itheima.api.client.vo.TBlogByTagID;
import com.itheima.blog.admin.service.IIndexService;
import com.itheima.api.client.vo.BlogContributionVO;
import com.itheima.blog.admin.vo.SummaryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/report")
@Api(tags = "首页")
@RequiredArgsConstructor
public class IndexController {
    private final IIndexService iIndexService;
    @GetMapping("/summary")
    @ApiOperation("获取总评论、文章数")
    public SummaryVo getSummary(){
        return iIndexService.getSummary();
    }

    @GetMapping("/tag/blogs")
    @ApiOperation("每个标签的文章数")
    public List<TBlogByTagID> getTBlogByTagID(){
        return  iIndexService.getTBlogByTagID();
    }

    @GetMapping("/category/blogs")
    @ApiOperation("每个分类的文章数")
    public List<TBlogByCategoryID> getTBlogByCategoryID(){
        return  iIndexService.getTBlogByCategoryID();
    }

    @PostMapping("/contribute")
    @ApiOperation("文章贡献度")
    public List<BlogContributionVO> getBlogContributions(){
        return iIndexService.getBlogContributions();
    }

    @GetMapping("/province/blogs")
    @ApiOperation("每个省份发博客数量(地图)")
    public List<ProvinceBLogNum>  getProvinceBLogNum( Integer classify){
        return iIndexService.getProvinceBLogNum(classify);
    }

}
